package iscript.coreFramework.tweens 
{

	import flash.utils.getTimer;
	import iscript.coreFramework.tweens.easing.Linear;
 

	public class TweenObject  
	{
		
		public function TweenObject(duration:Number=0, vars:Object=null) 
		{
			//var a:TweenObjectVars = new TweenObjectVars();
			   _duration =1000;
		}
		
		private  var  _startPosition:Number=0;		
		private  var  _finishPosition:Number=1000;
		private  var  _currentPosition:Number = 0;
		private  var  _duration:Number;
		protected var _ease:Function=Linear.easeIn;
		
		private var _position:*;
		
		/*这是as代码，四个参数分别是：
		t：current time（当前时间）；
		b：beginning value（初始值）；
		c： change in value（变化量）；
		d：duration（持续时间）。
		*/
		
	 
		private var  _startTime:Number;
		private var  _currentTime:Number;
		
		public function start():void {
			_startTime = getTimer();
			_currentTime = _startTime;		 
		}
		
		public  function update():void {
				if (_currentTime-_startTime < _duration) {
					_position = _ease(_currentTime-_startTime, _startPosition, _finishPosition-_startPosition, _duration);				
					_currentTime = getTimer(); 
				}else {
					_position = _finishPosition;
				}
			}
		 
		
		public function pause():void {			
			
			}
			
		 public  function get position():Number {
			return _position;
	 	}
		
	}

}